package com.fly.uaa.controller;

import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.security.Principal;

/**
 * @description
 * @author: fly
 * @date: 2018/11/26 14:46
 */
@Api(value = "Uaa Api", tags = "授权相关接口")
@RequestMapping("/users")
public class LoginController {

    @PreAuthorize("#oauth2.hasScope('user')")
    @RequestMapping(value = "/current", method = RequestMethod.GET)
    public Principal getUser(Principal principal) {
        return principal;
    }
}
